Add Size hint enum - #2294
Conversation
Clanker reviewThe core fix looks sound: the new That said, a few things are worth addressing before merge — especially while these majors are still unpublished. 🔴 Should fix1. The fix is one-sided:
2.
3. The At 🟠 API design (cheap to fix now, breaking later)4.
5.
6. "Failed because the input is exactly one complete frame" is an impossible state every error consumer must still write an unreachable arm for, and a future refactor accidentally returning 7. The checked/unchecked naming pair implies a validation distinction that no longer exists (cf. 8. Nothing in the repo constructs this variant except its own Display test, yet its payload was retyped ( 🟡 Docs / error messages9. "The decoder buffer holds a complete frame plus…" / "Buffer holds 10. The recovery contract is contradictory between doc and test — The 11. The rewritten docs make 12. It says the count is "the number of bytes still required to complete the frame", omitting the caveat (documented on 🧹 Cleanup / tests13. The The only place a 14. Duplicated reset-and-drain in the The 15. Minor points on the new tests —
Also: 🤖 Reviewed with Claude Code |
1a3f22f to
1824e48
Compare
Missing/Exact/Surplus replaces the sign-encoded isize, size_hint no longer panics on unparseable headers, and the infallible HandShakeFrame::from_bytes absorbs its unchecked twin.
Writing past the writable() slice used to underflow the missing-bytes arithmetic. Every decoder phase now drains the buffers and reports the surplus; noise transport callers must reconnect, since the AEAD nonce may already have advanced for the dropped frame.
1824e48 to
e229d08
Compare
e229d08 to
5adfab5
Compare
It sits in from_bytes' error position, so downstream code formats it in log messages.
|
@GitGab19 I didn't took all the suggestion but few of them. We will standardize few things with codec/framing refactor. |
closes: #2086